package com.gzwanchuang.lszg.adapter;

import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.gzwanchuang.lszg.R;
import com.gzwanchuang.lszg.proto.Recharge;

public class AccountAdapter extends BaseQuickAdapter<Recharge.My_earnings.wallet_list, BaseViewHolder> {
    private int[] bgColors = {R.mipmap.bg_red_one, R.mipmap.bg_blue_two, R.mipmap.bg_yello_three, R.mipmap.bg_green_four};

    public AccountAdapter(Context context) {
        super(R.layout.item_account);
    }

    @Override
    protected void convert(BaseViewHolder helper, Recharge.My_earnings.wallet_list item) {
        int bgColor = helper.getLayoutPosition() % 4;
        helper.setBackgroundResource(R.id.ll_account_bg, bgColors[bgColor]);
        helper.setText(R.id.tv_type, item.getWalletName())
                .setText(R.id.tv_money_one, "￥" + item.getBalance());
        helper.setText(R.id.tv_money_tow, "￥" + item.getAvailable());
        if (item.getAvailable().length() == 0) {
            helper.setGone(R.id.tv_money_tow, true)
                    .setGone(R.id.tv_message_two, true);
        } else {
            helper.setGone(R.id.tv_money_tow, false)
                    .setGone(R.id.tv_message_two, false);
        }
    }

}
